﻿<%@ control language="C#" autoeventwireup="true" inherits="admin_WebUserControl_admin_product, App_Web_m6ygvhfd" %>

<%@ Register Src="../WebUserControl/PageNavigation.ascx" TagName="PageNavigation"
    TagPrefix="uc1" %>
<style type="text/css">
    .pic{width:50px}

    input.sortnum{width:30px;font-size:8pt;font-family:Arial;text-align:right}
    #productTypeID{width:180px}
    .tf{width:50px}
</style>
<script language="javascript">
    function __modify(__productid)
    {
        document.location="productpub.aspx?productid="+__productid+"&urlhref="+escape(location);
    }
    function __delete(__productid)
    {
        if (confirm("您真的要删除该产品信息吗？"))
        {
            document.location = "productdelete.aspx?batchproductid=" + __productid + "&urlhref=" + escape(location);
        }
    }
    function __batch_delete() {
        var r = $form.getCheckboxValue("productid");
        if (!r) {
            alert("请选择要转移的产品记录");
            return false;
        }
        if (confirm("您真的要删除选中的产品信息吗？")) {
            document.location = "productdelete.aspx?batchproductid=" + r + "&urlhref=" + escape(location);
        }
    }
    window.onload=function()
    {
	    $form.addOption("productTypeID","","所有分类");
	    $form.addOptionsByXML("xmlproducttype.aspx","productTypeID","producttypeid","producttypename");
	    $form.addOption("toproducttypeid", "", "选择分类");
	    $form.addOptionsByXML("xmlproducttype.aspx", "toproducttypeid", "producttypeid", "producttypename");      
        var className;
        
        $("a.pic").each(function(){
            if ($(this).attr("href")!="")
            {
                className=$fso.getExtName($(this).attr("href"));
                $(this).addClass(className);
            }
        
        });
        
    }
    
    function __updatesortnum(__productid)
    {
        var v=$("#sortnum"+__productid).val()
        if (v!="")
        {
            document.location="productupdatesortnum.aspx?productid="+__productid+"&sortnum="+v+"&urlhref="+escape(location);
        }
        else
        {
            alert("请填写排序号");
        }
    }

    function __batch_changeproducttype() {
        var r = $form.getCheckboxValue("productid");
        if (!r) {
            alert("请选择要转移的产品记录");
            return false;
        }
        var v = document.getElementById("toproducttypeid").value;
        if (v == "") {
            alert("请选择要转移到哪个产品分类");
            return;
        }
        document.location = "productchangetype.aspx?productid=" + r + "&producttypeid=" + v + "&urlhref=" + escape(location);
    }

    function __batch_setisonsale(s) {
        var text = "";
        var v;
        if (s) {
            text = "上架";
            v = 1;
        }
        else {
            text = "下架";
            v = 0;
        }
        
        var r = $form.getCheckboxValue("productid");
        if (!r) {
            alert("请选择要" + text + "的产品记录");
            return false;
        }
        document.location = "productsetonsale.aspx?productid=" + r + "&isonsale=" + v + "&urlhref=" + escape(location);
    }
    function __batch_setistop(s) {
        var text = "";
        var v;
        if (s) {
            text = "推荐";
            v = 1;
        }
        else {
            text = "不推荐";
            v = 0;
        }

        var r = $form.getCheckboxValue("productid");
        if (!r) {
            alert("请选择要" + text + "的产品记录");
            return false;
        }
        document.location = "productsettop.aspx?productid=" + r + "&istop=" + v + "&urlhref=" + escape(location);
    }
</script>

<form method="get">
    <fieldset><legend>搜索</legend>
        <table>
            <tr>
                <td><select size="1" name="productTypeID" id="productTypeID" alerttext="产品分类"></select>
                </td>
                <td>产品名称<input type="text" name="keyword"/>
                </td>
                <td>
                    <input type="submit" value="搜索" name="btnsubmit" />
                </td>
            </tr>
        </table>
    </fieldset>
</form>
<div id="pagelist1" runat="server"></div>
<uc1:PageNavigation id="PageNavigation1" runat="server">
</uc1:PageNavigation>
<div class="buttons">
    <input type="button" value="全选" onclick="javascript:$form.checkboxSelect('productid',true);"/>
    <input type="button" value="全不选" onclick="javascript:$form.checkboxSelect('productid',false);"/>
    <input type="button" value="反选" onclick="javascript:$form.checkboxReverse('productid');"/>
    <!--
    <input type="button" value="设为推荐" onclick="javascript:__batch_setistop(true);"/>
    <input type="button" value="设为不推荐" onclick="javascript:__batch_setistop(false);"/>
    <input type="button" value="设为上架" onclick="javascript:__batch_setisonsale(true);"/>
    <input type="button" value="设为下架" onclick="javascript:__batch_setisonsale(false);"/>
    -->
    <input type="button" value="批量删除" onclick="javascript:__batch_delete();"/>
    <select size="1" name="toproducttypeid" id="toproducttypeid"></select>
    <input type="button" value="批量转移" onclick="javascript:__batch_changeproducttype();"/>
</div>